package cn.silver.framework.mybatis.enums;


import cn.silver.framework.core.model.DictModel;
import cn.silver.framework.core.utils.StreamUtils;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Stream;

@Getter
@AllArgsConstructor
public enum SearchTypeEnums {

    /**
     * 等于
     */
    EQ("=", "等于", "EQ"),
    /**
     * 不等于
     */
    NE("&lt;>", "不等于", "NE"),
    /**
     * 大于等于
     */
    GE("&gt;=", "大于等于", "GE"),
    /**
     * 大于
     */
    GT("&gt;", "大于", "GT"),
    /**
     * 小于等于
     */
    LE("&lt;=", "小于等于", "LE"),
    /**
     * 小于
     */
    LT("&lt;", "小于", "LT"),
    /**
     * 包含
     */
    LIKE("like", "包含", "LIKE"),
    /**
     * 范围查询
     */
    IN("in", "范围查询", "IN"),
    /**
     * 时间段
     */
    BETWEEN("between", "时间段", "BETWEEN");
    /**
     * 编码
     */
    private final String code;
    /**
     * 名称
     */
    private final String name;

    private final String expression;

    public static List<DictModel> getModels() {
        return StreamUtils.toList(Arrays.asList(values()), item -> new DictModel(item.name, item.code));
    }
}
